package cn.sptpc.servlet;

import cn.sptpc.service.ConsoleService;
import cn.sptpc.service.DepartmentService;
import cn.sptpc.service.impl.ConsoleeServiceI;
import cn.sptpc.service.impl.DepartmentServiceI;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/ConsoleServlet")
public class ConsoleServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/json;charset=gbk");
        PrintWriter out = response.getWriter();
        ConsoleService service = new ConsoleeServiceI();
        String count = request.getParameter("get");
        if (count.equals("count")){
            out.println(service.infoMation());
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
